interface Opts {
  title: string,
  imgUrl: string,
  path: string
}
export default function withShare(opts: Opts) {
  return (Component: any) => {

    //const Components = typeof Component === 'function' ? Component : typeof Component.wrappedComponent === 'function' ? Component.wrappedComponent : Component
    class Share extends Component {
      onShareAppMessage() {
        return {
          title: opts.title,
          path: opts.path,
          imageUrl: opts.imgUrl,
        };
      }
      render() {
        return super.render();
      }
    }

    return Share;
  };
}
